<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta name="copyright" content=
    "Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
    <link rel="stylesheet" href="../book.css" charset="ISO-8859-1"
    type="text/css" />
    <meta http-equiv="Content-Type" content=
    "text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <title>
      Adding new methods
    </title>
    <script language="JavaScript" type="text/javascript" src=
    "PLUGINS_ROOT/org.eclipse.help/livehelp.js">

</script>
  </head>
  <body>
    <h1>
      Adding new methods
    </h1>
    <ol>
      <li>Start adding a method by typing the following at the end
      of the <em>VectorTest.java</em> file (but before the closing
      brace of the type) in the Java editor:<br />

        <code>public void testSizeIsThree()</code><br />
        As soon as you type the method name in the editor area, the
        new method appears at the bottom of the Outline view.
        <p>
          <img src="images/editor_vectortest_testSizeIsThree.png"
          alt="New method in outline view" />
        </p>In addition,
        <ul>
          <li>error annotations (red boxes) appear in the overview
          ruler positioned on the right hand side of the editor,
          </li>
          <li>error icons appear in the vertical ruler positioned
          on the left of the editor,
          </li>

          <li>an error indicator appears in the top right corner of
          the editor,
          </li>
          <li>errors are marked in the text.
          </li>
        </ul>These error annotations indicate that the compilation
        unit is currently not correct. If you hover over the error
        in the text, a tool tip appears: <em>Syntax error on token
        ")", { expected after this token</em>. This is correct
        since the method doesn't have a body yet. Note that error
        annotations in the editor are updated as you type. This
        behavior can be controlled via the <strong>Report problems
        as you type</strong> option located on the <a class=
        "command-link" href=
        'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaEditorPreferencePage)")'>
        <img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg"
        alt="Goto the Java editor preference page" /> <strong>Java
        &gt; Editor</strong></a> preference page.
        <p>

          <img src="images/editor_vectortest_problem_hover.png"
          alt="Error annotations in vertical and overview ruler" />
        </p>
      </li>
      <li>Click the <strong>Save</strong> button. The compilation
      unit is compiled automatically and errors appear in the
      Package Explorer view, in the Problems view and on the
      vertical ruler (left hand side of the editor). In the Package
      Explorer view, the errors are propagated up to the project of
      the compilation unit containing the error.
        <p>
          <img src=
          "images/view_package_explorer_vectortest_error.png" alt=
          "Error propagation in package explorer" />
        </p>
      </li>

      <li>Complete the new method by typing the following:<br />
        <p>
          <code>{<br />
          &nbsp; //TODO: Check size<br /></code>
        </p>Note that the closing curly brace has been inserted
        automatically.
      </li>
      <li>Save the file. Notice that the error indicators disappear
      since the missing brace has been added.
      </li>

    </ol>
    <p class="nav_footer" id="nav_footer">
      Next Section: <a href="qs-ContentAssist.htm">Using content
      assist</a>
    </p>

    <h3 class="related">Related concepts</h3>
      <a href="../concepts/concept-java-editor.htm">Java
      editor</a><br />

    <h3 class="related">Related references</h3>
      <a href=
      "../reference/preferences/java/ref-preferences-editor.htm">Java
      Editor Preferences</a><br />

  </body>
</html>
